using System;
using System.Collections.Generic;
using System.Text;

namespace cuberga.Workflow
{
    public class ConditionalLink : AbstractLink
    {
        private Condition _condition;
        private bool _greenLightResult;

        public ConditionalLink(Process destinationProcess,
                               Condition condition,
                               bool greenLightResult) : base(destinationProcess)
        {
            _condition = condition;
            _greenLightResult = greenLightResult;
        }

        public override void PropagateMarker()
        {
            if (_condition.IsTrue() == _greenLightResult) {
                _destinationProcess.SetMarker();
            }
        }
    }
}
